﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class InfoText : MonoBehaviour {
    public GameObject textPivot;
    public BeamRayInteractive rayInteractive;
    public LineRenderer render;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
        if(rayInteractive.hitRay!=null)
        {
            textPivot.SetActive(true);
            textPivot.transform.rotation = 
                Quaternion.LookRotation(textPivot.transform.position-BattleManager.Instance.LODCamera.transform.position ,Vector3.up);
            render.enabled = true;
            render.SetPosition(0, transform.position);
            render.SetPosition(1, textPivot.transform.position);
        }
        else
        {
            textPivot.SetActive(false);
            render.enabled = false;
        }
		
	}
}
